package com.example.liwushuo.fragment;

import java.util.ArrayList;
import java.util.List;

import com.example.liwushuo.R;
import com.example.liwushuo.adapter.AllZTAdapter;
import com.example.liwushuo.bean.homegridview.glzt.BaseAllZT;
import com.example.liwushuo.bean.homegridview.glzt.Collection;
import com.handmark.pulltorefresh.library.PullToRefreshListView;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Adapter;

public class Fragment_AllZT extends Fragment {

	private BaseAllZT bean;
	private PullToRefreshListView listView;
	private List<Collection> list;
	private AllZTAdapter adapter;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		list = new ArrayList<Collection>();
		bean = (BaseAllZT) getArguments().getSerializable("baseAllZT");
		list.addAll(bean.getData().getCollections());
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View view = inflater.inflate(R.layout.bar_little_goods, null);
		initView(view);
		return view;
	}

	private void initView(View view) {

		listView = (PullToRefreshListView) view
				.findViewById(R.id.little_goods_listView);
		adapter = new AllZTAdapter(getActivity(), list);
		listView.setAdapter(adapter);
	}
}
